package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

/**
 * 随堂小练习
 */
public class Test {
    public static void main(String[] args) throws IOException {
        String s;
        Scanner scan = new Scanner(System.in);
        FileOutputStream fos = new FileOutputStream("note.txt",true);
        s = scan.nextLine();
        while (!"exit".equalsIgnoreCase(s)){
            fos.write(s.getBytes(StandardCharsets.UTF_8));
            System.out.println("已经写入");
            s = scan.nextLine();
        }
        System.out.println("程序退出");
        fos.close();
    }
}
